#  打开文件
# f = open('D:/test.txt','a',encoding='UTF-8')
# # write写入
# f.write('rockycheng is a silly pig')
# # flush刷新
# f.flush()
# # close关闭
# f.close()
# 打开一个存在的文件
f = open('D:/test.txt','a',encoding='UTF-8')
# write写入、flush刷新
f.write('\nwhat he said is true')   # /n为换行
# close关闭
f.close()